<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%@ page import="performReservation.SMMDBBean"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.Vector"%>
<%!
	Vector<String[]> vec = new Vector<String[]>();
	String sale_num = null;
	String type =null;
	
	Cookie cookies[] = null;
	String email = null;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Processing...</title>
</head>
<body><%
		//auth
		cookies = request.getCookies();
		if(cookies!=null){
			for(int i = 0 ; i < cookies.length; i++){
				if(cookies[i].getName().equals("email")){
					email = cookies[i].getValue();
				}else 
				if(cookies[i].getName().equals("type")){
					type = cookies[i].getValue();
				}
			}
			if(email!=null&&type.equals("cus")){
				//get all orders of this customer
				%><TABLE border ="3" align="center">
	
					<TR>
						<TH>Performance Name :</TH>
						<TH>Cinema Name :</TH>
						<TH>Performance Time :</TH>
						<TH>Amount:</TH>
						<TH>Price :</TH>
						<TH>Total Price:</TH>
						<TH>Delete it:</TH>
						<TH>Modify it:</TH>
					</TR><%
				SMMDBBean pProcess = SMMDBBean.getInstance();
				%><jsp:useBean id="order" scope="page" class="performReservation.Orders"/><%
				order.setCusemail(email);
				vec = pProcess.getCusAllOrders(order);
				if(vec!=null){
					for(int i = 0; i < vec.size(); i++){
						String[] str = new String[9];
						str = vec.get(i);
						double totalPrice = 0.0;
						totalPrice = Integer.parseInt(str[7])*Integer.parseInt(str[4]);
						%>
						<TR>
							<TD><a href="performDetail.jsp?num=<%=str[1] %>"><%=str[0] %></a></TD>
							<TD><a href="cinemaDetail.jsp?num=<%=str[3] %>"><%=str[2] %></a></TD>
							<TD><%=str[6] %></TD>
							<TD><%=str[4] %></TD>
							<TD><%=str[7] %></TD>
							<TD><%=totalPrice %></TD>
							
							<TD><a href="deleteOrder.jsp?num=<%=str[8] %>&amount=<%=str[4] %>">Delete</a></TD>
							<TD><a href="modifyOrder.jsp?num=<%=str[8] %>&order_num=<%=str[5] %>">Modify</a></TD>
						</TR>
						<%
					}
				}
				%></Table><%
			}
		}
	   %>
</body>
</html>